#!/bin/bash

echo "启动设备维修工作流系统后端..."

# 检查是否安装了.NET SDK
if ! command -v dotnet &> /dev/null; then
    echo "错误: 未找到.NET SDK，请先安装.NET 8.0 SDK"
    echo "下载地址: https://dotnet.microsoft.com/download"
    exit 1
fi

# 进入后端目录
cd DeviceRepairWorkflow.Api

echo "恢复NuGet包..."
dotnet restore

echo "构建项目..."
dotnet build

echo "启动应用..."
echo "后端将在 http://localhost:5000 启动"
echo "Swagger文档: http://localhost:5000/swagger"
echo "Elsa工作流管理: http://localhost:5000/elsa/studio"
echo ""
echo "按 Ctrl+C 停止应用"

dotnet run 